home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 11 / Mac Magazin and MacEasy Magazine CD - Issue 11.iso / Sharewarebibliothek / Entwickler / ThreadLibrary-1.0 / Interfaces / ThreadLibraryStubs.h < prev   
Text File  |  1995-06-08  |  3KB  |  98 lines

  1. /* See the file Distribution for distribution terms.
  2.     (c) Copyright 1994-1995 Ari Halberstadt */
  3.  
  4. /*
  5.     Following are stubs that you can include in your source files.
  6.     These stubs will remove any threaded behavior from your program.
  7.     When you call ThreadBegin, the thread's entry point will be
  8.     called immediately. Control will resume after the call to
  9.     ThreadBegin when the thread's entry point has exited.
  10.     
  11.     You must include this file either instead of "ThreadLib.h",
  12.     or before you include "ThreadLib.h" in your source files.
  13.     
  14.     With these stubs, you can't:
  15.     
  16.     - use ThreadDataSet to store a data pointer
  17.     the thread
  18.     
  19.     - have the full complement of thread callbacks executed
  20.     
  21.     - iterate over threads, since there are no threads
  22.     
  23.     - use threads that run in an infinite loop, since they'll
  24.     never return control to the remainder of the program
  25.     
  26.     Warning: these stubs violate the conditions maintained by
  27.     Thread Library and expressed in its assertions and documentation.
  28.     These stubs also use macros that may discard their parameters without
  29.     evaluating them. These stubs are merely meant to enable you to test
  30.     your application without threads, in the event you suspect that Thread
  31.     Library is causing errors in your software.
  32.     
  33.     950214 aih updated for latest interface
  34.     941003 aih created
  35. */
  36.  
  37. #pragma once
  38. #ifndef THREAD_LIBRARY_STUBS
  39. #define THREAD_LIBRARY_STUBS
  40.  
  41. #include "ThreadLibrary.h"
  42.  
  43. /*    If this file is included, then stubs are enabled
  44.     by default. */
  45. #ifndef THREAD_STUB_ENABLED
  46.     #define THREAD_STUB_ENABLED (1)
  47. #endif
  48.  
  49. #if THREAD_STUB_ENABLED
  50.  
  51.     #define THREAD_STUB_SN                ((ThreadType) 1)
  52.  
  53.     #define ThreadError()                ((ThreadErrorType) 0)
  54.     #define ThreadErrorSet()            ((void) 0)
  55.     #define ThreadCount()                (THREAD_STUB_SN)
  56.     #define ThreadMain()                (THREAD_STUB_SN)
  57.     #define ThreadActive()                (THREAD_STUB_SN)
  58.     #define ThreadFirst()                (THREAD_STUB_SN)
  59.     #define ThreadNext(t)                (t)
  60.     #define ThreadExists(t)                (true)
  61.     #define ThreadSaveFPU(t)            (false)
  62.     #define ThreadSaveFPUSet(t,f)        ((void) 0)
  63.     #define ThreadData(t)                (NULL)
  64.     #define ThreadDataSet(t,d)            ((void) 0)
  65.     #define ThreadProcAllocate()        (NULL)
  66.     #define ThreadProcAllocateSet(f)    ((void) 0)
  67.     #define ThreadProcDispose()            (NULL)    
  68.     #define ThreadProcDisposeSet(f)        ((void) 0)
  69.     #define ThreadProcBegin(t)            (NULL)    
  70.     #define ThreadProcBeginSet(t,f)        ((void) 0)
  71.     #define ThreadProcEnd(t)            (NULL)    
  72.     #define ThreadProcEndSet(t,f)        ((void) 0)
  73.     #define ThreadProcResume(t)            (NULL)    
  74.     #define ThreadProcResumeSet(t,f)    ((void) 0)
  75.     #define ThreadProcSuspend(t)        (NULL)    
  76.     #define ThreadProcSuspendSet(t,f)    ((void) 0)
  77.     #define ThreadProcEntry(t)            (NULL)    
  78.     #define ThreadProcEntrySet(t,f)        ((void) 0)
  79.     #define ThreadStackMinimum()        ((size_t) 0)
  80.     #define ThreadStackDefault()        ((size_t) 0)
  81.     #define ThreadStackSpace(t)            ((size_t) StackSpace())
  82.     #define ThreadStackFrame(t,f)        ((void) 0)
  83.     #define ThreadEnabled(t)            (false)
  84.     #define ThreadEnabledSet(t,f)        ((void) 0)
  85.     #define ThreadSleepSet(t,s)            ((void) 0)
  86.     #define ThreadSchedule()            (THREAD_STUB_SN)
  87.     #define ThreadActivate(t)            ((void) 0)
  88.     #define ThreadYield(s)                ((void) 0)
  89.     #define ThreadYieldInterval()        (0)
  90.     #define ThreadBeginMain(s,r,d)        (THREAD_STUB_SN)
  91.     #define ThreadBegin(e,s,r,d,ss)        (THREAD_STUB_SN)
  92.     #define ThreadEnd(t)                ((void) 0)
  93.     #define ThreadEndAll(t)                ((void) 0)
  94.  
  95. #endif /* THREAD_STUB_ENABLED */
  96.  
  97. #endif /* THREAD_LIBRARY_STUBS */
  98.